﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DcsGauges.Shared.Packets
{
    public class PacketSerializationBase
    {
        protected const string    START_TAG_OPEN                  = "<";
        protected const string    START_TAG_CLOSE                 = ">";
        protected const string    END_TAG_OPEN                    = "</";
        protected const string    END_TAG_CLOSE                   = ">";

        protected const char       SEPERATOR                       = ';';


        protected static Tuple<string, string> GetTag(string packetName)
        {
            string startTag = GetStartTag(packetName);
            string endTag   = GetEndTag(packetName);
            return new Tuple<string, string>(startTag, endTag);
        }


        protected static string GetStartTag(Packet packet)
        {
            return GetStartTag(packet.PacketName);
        }


        protected static string GetEndTag(Packet packet)
        {
            return GetEndTag(packet.PacketName);
        }


        protected static string GetStartTag(string packetName)
        {
            return START_TAG_OPEN + packetName + START_TAG_CLOSE;
        }


        protected static string GetEndTag(string packetName)
        {
            return END_TAG_OPEN + packetName + END_TAG_CLOSE;
        }
    }
}
